library(tidyverse)
library(magrittr)
library(DT)
library(gt)
library(gtExtras)
library(countrycode)
library(ggflags)
library(downloadthis)
ds <- read_rds("pinot.rds")
# head(ds)
Abstract
This project aims to explore alternative techniques for designing visually appealing and comprehensible data tables. Traditional Excel spreadsheets often lack readability and visual impact. By incorporating design principles such as color theory, typography, and layout, we aim to create visually striking data tables that effectively convey information. Additionally, we will evaluate innovative software tools and platforms that offer user-friendly options for creating functional and aesthetically pleasing data tables. Enhancing data presentation is crucial for improving interpretation and understanding.
Introduction
Excel spreadsheets are widely used for organizing and presenting data. However, their conventional format can be tedious and challenging to read, hindering data comprehension. This project seeks to address this limitation by exploring various techniques to design visually appealing and comprehensible data tables.
The primary focus is to create data tables that are not only aesthetically pleasing but also convey information effectively. By employing design principles such as color theory, typography, and layout, we aim to enhance the visual impact and readability of data tables. This will involve experimenting with different combinations of colors, fonts, and arrangement patterns to find the most optimal design choices.
It is crucial to recognize that the presentation of data plays a significant role in its interpretation and understanding. The traditional Excel format often lacks visual cues to highlight key data points or insights. Therefore, this project seeks to explore new and innovative methods of presenting data tables that not only serve their functional purpose but also captivate the audience with their visual appeal.
Advanced Data Tables
ds_starter <- ds %>%
mutate(
province = as.factor(province),
price = price,
thetaPointMean = mean(points),
thetaPriceMean = mean(price)
)
ds_starter %>%
arrange(province, year) %>%
select(
Province = province,
Year = year,
Price = price,
Points = points,
Description = description
) %>%
datatable(.,
filter = "bottom",
extensions = "Buttons",
options = list(
dom = "Bfrtip",
buttons = c("copy", "csv", "excel"),
initComplete = JS(
"function(settings, json) {",
"$(this.api().table().header()).css({'background-color': '#131F4F', 'color': '#fff'});",
"}"
)
)
)ds_summary <- ds_starter %>%
group_by(province) %>%
arrange(year) %>%
summarise(
pointsMean = mean(points, na.rm = TRUE),
pointsSD = sd(points),
priceMean = mean(price, na.rm = TRUE),
priceSD = sd(price),
points = list(points),
price = list(price),
.groups = "drop"
)excel_file_attachment <- ds_summary %>%
download_this(
output_name = "Pinot_Noir_Summary",
output_extension = ".xlsx", # Excel file type
button_label = "Download Excel",
button_type = "primary", # change button type
)Adding Trend Lines To Summary Tables
fancyTbl <- ds_summary %>%
gt() %>%
# format the numeric output to 3 digit rounding
fmt_number(
columns = c(pointsMean, pointsSD, priceMean, priceSD),
decimals = 3
) %>%
# create nice labels for a few ugly variable names
cols_label(
province = "Province",
pointsMean = "Avg. Points",
pointsSD = "Std. Dev. Points",
priceMean = "Avg. Price",
priceSD = "Std. Dev. Price",
points = "Points Trend",
price = "Price Trend",
) %>%
# Plot the sparklines from the list column
gt_plt_sparkline(points,
type = "ref_median",
same_limit = TRUE
) %>%
gt_plt_sparkline(price,
type = "ref_median",
same_limit = TRUE
) %>%
# use the guardian's table theme
gt_theme_guardian() %>%
# give hulk coloring to the Mean Human Rights Score
gt_hulk_col_numeric(pointsMean) %>%
gt_hulk_col_numeric(priceMean) %>%
# create a header and subheader
tab_header(title = "Province Pinot Wine Summary", subtitle = "Source: Dr. Hendrick") %>%
# attach excel file
tab_source_note(excel_file_attachment)
# save the original as an image
# gtsave(fancyTbl, "table.png")
# show the table themed in accordance with the page
fancyTblConclusion
This project highlights the importance of visually appealing and comprehensible data tables as an alternative to Excel. By incorporating design principles and exploring innovative tools, we enhance data presentation and interpretation. It calls for adopting alternative techniques to design data tables. By embracing visually appealing formats, we improve data comprehension, communication, and unlock new possibilities for visualization and analysis.